#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author   : Moty
# @Time     : 2024/1/22 0:10
# @File     : jt808_8107.py
# @Project  : jt808
def parse_terminal_attribute_reply(body):
    # 解析0x8107 查询终端属性
    data = {
        # 消息体为空
        "终端类型": body[0:4],
        "制造商ID": int(body[4:14], 16) + body[4:14],
        "终端型号": body[14:74],
        "终端ID": body[74:134],
        "终端SIM卡ICCID": body[134:154],
        "终端硬件版本号长度": body[154:156],
        "终端硬件版本号": body[156:int(body[154:156], 16) + 156],
        "终端固件版本号长度": body[int(body[154:156], 16) + 156:int(body[154:156], 16) + 157],
        "终端固件版本号": body[int(body[154:156], 16) + 157:int(body[154:156], 16) + 157 + int(body[int(body[154:156], 16) + 156:int(body[154:156], 16) + 157], 16) + 157],
        "GNSS模块属性": body[int(body[154:156], 16) + 157 + int(body[int(body[154:156], 16) + 156:int(body[154:156], 16) + 157], 16) + 157:],
        "通讯模块属性": body[14:],
    }
    formatted_data = ""
    for key, value in data.items():
        formatted_data += f"{key}: {value}\n"
    return formatted_data


__all__ = ['parse_terminal_attribute_reply']
